#include "lib_event.h"

static eMBEventType eQueuedEvent;
static BOOL     xEventInQueue;

void EventInit( void ) {
    xEventInQueue = FALSE;
}

void EventPost( eMBEventType eEvent ) {
    xEventInQueue = TRUE;
    eQueuedEvent = eEvent;
}

BOOL EventGet( eMBEventType * eEvent ) {
    BOOL            xEventHappened = FALSE;
    if( xEventInQueue ) {
        *eEvent = eQueuedEvent;
        xEventInQueue = FALSE;
        xEventHappened = TRUE;
    }
    return xEventHappened;
}
